//供应商管理-供应商列表-配置文件
App.util.ns('Admin.Supplier.Supplier');
Admin.Supplier.Supplier.Conf = {
    columns: [
        {name: '供应商名称', value: 'name'},
        {name: '登录账号', width: '200px', value: function(item){
            return item.admin ? item.admin.username : '无';
        }},
        {name: '联系人', width: '120px', value: 'contact_name'},
        {name: '联系电话', width: '120px', value: 'contact_tel'},
        {name: '状态', width: '80px', value: function(item){
            switch (item.status+'') {
                case '0':
                    return '停用';
                case '1':
                    return '正常';
            }
        }},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        {type: 'input', name: 'username', title: '登录账号', required: true, rule: {
            type: 'str',
            range: [1, 100]
        }},
        [
            {type: 'password', name: 'password', title: '登录密码', required: true, rule: {
                type: 'str',
                range: [1, 100]
            }},
            {type: 'password', name: 're_password', title: '确认密码', required: true, rule: function(self){
                return self.form.formItems['password'].value() === self.value();
            }}
        ],
        {type: 'input', name: 'name', title: '供应商名称', required: true, maxLength: 40, rule: {
            type: 'str',
            range: [1, 40]
        }},
        {type: 'input', name: 'contact_name', title: '联系人',rule: {
            type: 'str',
            range: [0, 255]
        }},
        {type: 'input', name: 'contact_tel', title: '联系电话', rule: {
            type: 'num'
        }},
        {type: 'textarea', name: 'introduction', title: '简介', maxLength: 200,
            rule: {
            type: 'str',
            range: [0, 200]
        }}
    
    ]
};